package edu.zut.cs.software.estateagent.property.domain;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import edu.zut.cs.software.base.domain.BaseTreeEntity;

@Table(name = "E_Holder") // 数据库表名
@Entity // 声明持久化类
@NamedQueries({
	@NamedQuery(name = "Holder.getRoot", query = "select 1  from Holder "),
	@NamedQuery(name = "Holder.getCount", query = "select count(*)  from Holder")
})

public class Holder extends BaseTreeEntity<Holder> {

	/**
	 * 
	 */
	/**
	 * @author wusudan
	 *
	 */
	@GeneratedValue(strategy = GenerationType.AUTO) // 生成主键
	private static final long serialVersionUID = -1751456589871998469L;

	@Column(name = "NAME")
	String name;// 房主名字

	@OneToMany(mappedBy = "holder", cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
	Set<Property> property;// 房主1-*房产
	@Column(name = "EMAIL")
	String email;// 房主邮件
	@Column(name = "TELE")
	String telephone;// 房主电话
	@Column(name = "PASSWORD")
	String password;// 房主密码

	public String getName() {
		return name;
	}

	public String getEmail() {
		return email;
	}

	public String getTele() {
		return telephone;
	}

	public String getPassword() {
		return password;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public void setTele(String telephone) {
		this.telephone = telephone;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public void changeName(String name) {
		this.name = name;
	}
}